package com.jeff.android.lab.architecture.mvvm;

import android.os.Bundle;
import android.os.Handler;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.databinding.DataBindingUtil;
import androidx.fragment.app.Fragment;

import com.jeff.android.lab.R;
import com.jeff.android.lab.databinding.ArchitectureMvvmFragmentBinding;

public class MvvmFragment extends Fragment {

    ArchitectureMvvmFragmentBinding binding;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.architecture_mvvm_fragment, container, false);
        binding = DataBindingUtil.bind(view);
        binding.setUser(new User("dingfeng", 29));

        new Handler()
                .postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        binding.setUser(new User("Jack", 16));
                    }
                }, 3000);
        return view;
    }


}
